﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Jquery PlugIns Test Demo</title>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
    <script src="jquery.query-2.1.7.js" type="text/javascript"></script>
    <script type="text/javascript">

        if ($.query.get("action") == "")
            window.location.href = "jquery.query.Demo.htm?action=view&section=info&id=123&debug&testy[]=true&testy[]=false&testy[]";

        $(document).ready(function () {

            var url = location.search;
            //"?action=view&section=info&id=123&debug&testy[]=true&testy[]=false&testy[]"
            $('<div />').html(url).appendTo($('#msg'));

            var section = $.query.get('section');
            //"info"
            $('<div />').html(section).appendTo($('#msg'));

            var id = $.query.get('id');
            //123
            $('<div />').html(id).appendTo($('#msg'));

            var debug = $.query.get('debug');
            //true
            $('<div />').html(debug.toString()).appendTo($('#msg'));

            var arr = $.query.get('testy');
            //["true", "false", true]
            $('<div />').html(typeof (arr)).appendTo($('#msg'));
            $('<div />').html(arr[0]).appendTo($('#msg'));

            var arrayElement = $.query.get('testy[1]');
            //"false"

            var newUrl = $.query.set("section", 5).set("action", "do").toString();
            //"?action=do&section=5&id=123"

            var newQuery = "" + $.query.set('type', 'string');
            //"?action=view&section=info&id=123&type=string"

            var oldQuery = $.query.toString();
            //"?action=view&section=info&id=123"

            var oldQuery2 = $.query;
            //?action=view&section=info&id=123
            $('<div />').html(oldQuery2.toString()).appendTo($('#msg'));

            var newerQuery = $.query.SET('type', 'string');
            //?action=view&section=info&id=123&type=string

            var notOldQuery = $.query.toString();
            //"?action=view&section=info&id=123&type=string"

            var oldQueryAgain = $.query.REMOVE("type");
            //?action=view&section=info&id=123

            var emptyQuery = $.query.empty();
            //""

            var stillTheSame = $.query.copy();
            //?action=view&section=info&id=123

        });
    </script>
</head>
<body>
    <div id="msg">
    </div>
</body>
</html>
